Skip to content

Conversation

carlescufi
Copy link
Member

C99 has been the minimum required C standard version for Zephyr since its inception. After multiple attempts and discussions, a decision has been made to upgrade to C17 going forward.
This commits replaces the default C standard from C99 to C17 in the configuration and build system.

@carlescufi
Copy link
Member Author

@stephanosio @nashif @keith-packard should we also enforce C++17 at the same time, for consistency?

C99 has been the minimum required C standard version for Zephyr since
its inception. After multiple attempts and discussions, a decision has
been made to upgrade to C17 going forward.
This commits replaces the default C standard from C99 to C17 in the
configuration and build system.

Signed-off-by: Carles Cufi <[email protected]>
As part of the transition from C99 to C17 as the minimum supported C
standard version, remove the workarounds in the formatted output
subsystem to maintain compatibility with toolchains that do not support
the _Generic keyword.

Signed-off-by: Carles Cufi <[email protected]>
Copy link

sonarqubecloud bot commented Oct 6, 2025

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to drop these compiler feature flags? This will require all out-of-tree dependencies to drop this (even if they do support an older C standard version?).

I think this can remain, as newer standards should support older flags.

@nvetrini
Copy link
Contributor

nvetrini commented Oct 7, 2025

@nashif You may want to consider switching to MISRA C:2012 Amendment 3 as a basis for the guidelines after updating the baseline C standard version, since that edition of the guidelines have much better coverage of C17 than Amendment 2 (e.g. it has guidelines for the safe use of _Generic, which are not present in Amendment 2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants